package Algorithm.LinkListTest;

public class Re {

    public ListNode reverseList(ListNode head) {

        if(head == null){
            return null;
        }

        ListNode cur = head,prev = null;

        while(cur.next != null){
            ListNode tmp = cur.next;
            cur.next = prev;
            prev = cur;
            cur = tmp;
        }
        return prev;
    }
}
